<?php
namespace Modules\ShopApi\Http\Controllers\v1;
use Illuminate\Http\Request;
use Modules\AuthAdmin\Http\Requests\CommonIdRequest;
use Modules\ShopApi\Models\ShopOrder as ShopOrderModel;
use Modules\ShopApi\Models\ShopOrderEvaluate as ShopOrderEvaluateModel;
use Modules\ShopApi\Models\ShopOrderComplain as ShopOrderComplainModel;
class OrderController extends CommonController
{
	 
	/**
	 * @name  订单列表
	 * @method  GET
	 * @param  page int 页码	
	 * @param  status int 订单状态	
	 * @return  JSON
	 */
    public function get_order_list(Request $request)
    {
		return (new ShopOrderModel())->get_order_list($request->get('status'));
    }
	/**
	 * @name  商品详情
	 * @method  GET
	 * @param  id int 订单id	
	 * @return  JSON
	 */
    public function get_order_detail(CommonIdRequest $request)
    {
		return (new ShopOrderModel())->get_order_detail($request->get('id'));
    }
	/**
	 * @name  取消订单
	 * @method  PUT
	 * @param  id int 订单id	
	 * @return  JSON
	 */
    public function order_cancel(CommonIdRequest $request)
    {
		return (new ShopOrderModel())->order_cancel($request->get('id'));
    }
	/**
	 * @name  确认收货
	 * @method  PUT
	 * @param  id int 订单id	
	 * @return  JSON
	 */
    public function order_confirm(CommonIdRequest $request)
    {
		return (new ShopOrderModel())->order_confirm($request->get('id'));
    }
	/**
	 * @name  商品评价页
	 * @method  GET
	 * @param  id int 订单id	
	 * @return  JSON
	 */
    public function get_order_evaluate(CommonIdRequest $request)
    {
		return (new ShopOrderModel())->get_order_evaluate($request->get('id'));
    }
	/**
	 * @name  商品评价
	 * @method  POST
	 * @param  order_id int 订单id	
	 * @param  product_id int 商品id	
	 * @param  content int 评价内容	
	 * @param  images array 图片	
	 * @param  level int 星级：1=非常差，2=差，3=一般，4=好，5=非常好	
	 * @return  JSON
	 */
    public function order_evaluate(Request $request)
    {
		return (new ShopOrderEvaluateModel())->order_evaluate($request->all());
    }
	/**
	 * @name  订单申诉
	 * @method  POST
	 * @param  order_id int 订单id	
	 * @param  content int 申诉内容	
	 * @param  images array 图片
	 * @return  JSON
	 */
    public function order_complain(Request $request)
    {
		return (new ShopOrderComplainModel())->order_complain($request->all());
    }
	/**
	 * @name  微信支付
	 * @method  POST
	 * @param id int 订单id
	 * @return  JSON
	 */
    public function wx_order_pay(CommonIdRequest $request)
    { 
        return (new ShopOrderModel())->wx_order_pay($request->get('id'));
    }
	/**	 	 
	 * @name  微信支付回调		 
	 * @method  ANY			 
	 */    
	public function notify_pay(Request $request){			
		return (new ShopOrderModel())->notify_pay();   
	}
	/**	 	 
	 * @name  微信支付回调		 
	 * @method  ANY			 
	 */    
	public function h5_notify_pay(Request $request){			
		return (new ShopOrderModel())->h5_notify_pay();   
	}
}
